﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsControlLibrary1
{
    public partial class LQB : UserControl
    {
        public LQB()
        {
            InitializeComponent();
            mytimer = new Timer();
            mytimer.Interval = 10;
            mytimer.Tick += new EventHandler(mytimer_Tick);
            mytimer.Enabled = true;
        }

        private void mytimer_Tick(object sender, EventArgs e)
        {
            if (start)
            {
                if (index<indexMax)
                {
                    index++;
                    
                }
                else
                {
                    index = 0;
                }
            }
            change();
        }

        private void change()
        {
            switch (index)
            {
                case 0:
                    mainPic.Image = Properties.Resources.LQB_0;
                    break;
                case 1:
                    mainPic.Image = Properties.Resources.LQB_1;
                    break;
                case 2:
                    mainPic.Image = Properties.Resources.LQB_2;
                    break;
                case 3:
                    mainPic.Image = Properties.Resources.LQB_3;
                    break;
                case 4:
                    mainPic.Image = Properties.Resources.LQB_4;
                    break;
                case 5:
                    mainPic.Image = Properties.Resources.LQB_5;
                    break;
                case 6:
                    mainPic.Image = Properties.Resources.LQB_6;
                    break;
                default:
                    mainPic.Image = Properties.Resources.LQB_0;
                    break;
                
                              
            }
        }

        private int index;

        private Timer mytimer;

        private int interval = 10;

        public int Interval
        {
            get { return mytimer.Interval; }
            set
            {
                if (value!=mytimer.Interval)
                {
                    mytimer.Interval = value;
                } }
        }

        private bool start = true;
        public bool Start
        {
            get { return start; }
            set { start = value; }
        }

        private  int indexMax = 11;
        public int IndexMax
        {
            get { return indexMax; }
            set { indexMax = value; }
        }

        
    }
}
